package org.mazhi.enumtype;

public enum InvoiceType implements PersistEnum<InvoiceType>{

	
    HELP3("代开专票3%税", 0.03, 2),
    HELP0("普票6%税", 0.06, 4),
    ONEINVOICE6("专票6%税", 0.06, 6),
    HELP01("无发票6%税", 0.06, 7);

    /**
     * 状态代码
     */
    private int statusCode;

    /**
     * 状态描述
     */
    private String statusDescription;

    /**
     * 发票 比例
     */
    private Double rate;

    private InvoiceType(String statusDescription, Double rate, int statusCode) {
        this.statusCode = statusCode;
        this.rate = rate;
        this.statusDescription = statusDescription;
    }

    public String getStatusDescription() {
        return statusDescription;
    }

    public Integer getStatusCode() {
        return statusCode;
    }


    public Double getRate() {
        return rate;
    }

    public  String getStatusDescription(Integer statusCode) {
        for (InvoiceType invoiceType : InvoiceType.values()) {
            if (invoiceType.statusCode == statusCode) {
                return invoiceType.statusDescription;
            }
        }
        return null;
    }

    public  Double getRate(Integer statusCode) {
        for (InvoiceType invoiceType : InvoiceType.values()) {
            if (invoiceType.statusCode == statusCode) {
                return invoiceType.rate;
            }
        }
        return null;
    }

    public InvoiceType getEnum(Integer statusCode) {
        for (InvoiceType invoiceType : InvoiceType.values()) {
            if (invoiceType.statusCode == statusCode) {
                return invoiceType;
            }
        }
        return null;
    }


}
